package com.punai.standard.controller;

import com.punai.common.core.controller.BaseController;
import com.punai.common.core.page.TableDataInfo;
import com.punai.common.utils.StringUtils;
import com.punai.standard.domain.StaClFee;
import com.punai.standard.service.IStaClFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * 材料费用项Controller
 * 
 * @author zhx
 * @date 2022-12-21
 */
@RestController
@RequestMapping("/sta/clFee")
public class StaClFeeController extends BaseController
{
    @Autowired
    private IStaClFeeService staClFeeService;

    /**
     * 查询材料费用项列表
     */
    @PreAuthorize("@ss.hasPermi('sta:clFee:list')")
    @GetMapping("/list")
    public TableDataInfo list(StaClFee staClFee) {

        if (StringUtils.isEmpty(staClFee.getChapterId())) {
            return getDataTable(new ArrayList<>());
        }
        if (StringUtils.isEmpty(staClFee.getVersionId())) {
            throw new RuntimeException("版本id为空");
        }

        TableDataInfo tableDataInfo = staClFeeService.selectStaClFeeList(staClFee);
        return tableDataInfo;
    }

}
